package translator.messages;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public final class Messages {

    public enum ELang {
        EN(ResourceBundle.getBundle("translator.messages.messages_en")),
        CZ(ResourceBundle.getBundle("translator.messages.messages_cz"));

        private ResourceBundle bundle;
        private ELang(ResourceBundle bundle) {
            this.bundle = bundle;
        }
    }

    private static ELang language = ELang.EN;

    private Messages() {}

    public static String getString(String key) {
        try {
            return language.bundle.getString(key);
        } catch (MissingResourceException e) {
            return '!' + key + '!';
        }
    }

    public static void setLanguage(ELang lang) {
        language = lang;
    }

}